﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace BungaloEngine.Types
{
    public class Entity
    {
        private Entity _parent;

        public Vector2 pLocalPosition
        {
            get;
            set;
        }

        public Vector2 GetWorldPosition()
        {
            if (_parent != null)
                return pLocalPosition + _parent.GetWorldPosition();
            else
                return pLocalPosition;
        }

        public void AttachTo(Entity parent)
        {
            _parent = parent;
        }

        public void Detach()
        {
            _parent = null;
        }
    }
}
